﻿@model List<SelectListItem>
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Add</title>
    <script src="~/lib/layui/layui.js"></script>
    <link href="~/lib/layui/css/layui.css" rel="stylesheet" />
</head>
<body>
    <form class="layui-form" id="formAdd" action="">
        <div class="layui-form-item">
            <label class="layui-form-label">规格大小</label>
            <div class="layui-input-inline">
                <input type="text" name="GuiGeZhiName" required lay-verify="required" value="" placeholder="请输入规格大小" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">规格类别</label>
            <div class="layui-input-inline">
                @Html.DropDownList("GuiGeId", Model, "--请选择--")
            </div>
        </div>

        <div class="form-group">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="subData">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>

    </form>
    <script>

            layui.use(['layer', 'form'], function () {
                $ = layui.jquery;
                var layer = layui.layer, form = layui.form;
                form.on('submit(subData)', function (data) {
                    var str = $("#formAdd").serialize();

                    $.post("/GuiGe/GuiGeAdd_Storage", str, function (res) {
                        if (res.success) {
                            layer.msg("添加成功", function () {
                                // 获得frame索引
                                var index = parent.layer.getFrameIndex(window.name);
                                //关闭当前frame
                                parent.layer.close(index);
                                //修改成功后刷新父界面
                                window.parent.location.reload();
                            });
                        }
                        else {
                            layer.alert("添加失败:" + res.message, { icon: 5 });
                        }
                    }, "json");
                    return false;
                });
            });
    </script>
</body>
</html>
